package com.cooliris.media;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.VideoView;
import cn.real.device.HelixSubTitleManager;
import cn.real.device.HelixSubtitleService;

public class SubtitleVideoView extends VideoView {

	private HelixSubTitleManager mySTManager = null;
	
	public SubtitleVideoView(Context context) {
		super(context);
	}
	
	public SubtitleVideoView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public SubtitleVideoView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	public void setHelixSubtitleManager(HelixSubTitleManager st) {
		mySTManager = st;
	}

	@Override
	public void seekTo(int msec) {
		super.seekTo(msec);
		
		if (mySTManager != null) {
			mySTManager.OnSeek(msec);
		}
	}

	@Override
	public void start() {
		super.start();
		
		if (mySTManager != null) {
			mySTManager.OnPlay();
		}
	}

	@Override
	public void stopPlayback() {
		super.stopPlayback();
		
		if (mySTManager != null) {
			mySTManager.OnStop();
		}
	}

	@Override
	public void pause() {
		super.pause();
		
		if (mySTManager != null) {
			mySTManager.OnPause();
		}
	}

	@Override
	public void resume() {
		super.resume();
		
		if (mySTManager != null) {
			mySTManager.OnPlay();
		}
	}	
}
